import tempfile
def mock_tree_file(data, dir = None):
    tmp = tempfile.mkstemp(dir = dir)
    fh, fn = tmp
    with open(fn, 'w') as f:
        f.write(data)
    return fn
